package com.example.kt_base.s6

//TODO 103.Kotlin语言的抽象类
abstract class BaseActivity {
    fun onCreate() {
        setContentView(getLayoutID())
        initView()
        initData()
    }

    private fun setContentView(layoutID: Int) = println("加载：${layoutID}布局xml中")

    abstract fun getLayoutID(): Int
    abstract fun initView()
    abstract fun initData()

}

class MianActivity : BaseActivity() {
    override fun getLayoutID(): Int = 456
    override fun initView() {
        println("做具体初始化view")
    }

    override fun initData() {
        println("做具体数据初始化")
    }

    fun show() {
        super.onCreate()
    }
}

fun main() {
    MianActivity().show()
}
